package com.python.project2.controller;

import com.python.project2.service.HomeService;
import com.python.project2.util.ResponseUtil;
import com.python.project2.vo.IndexVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description
 * @Date 2023/3/31
 * @Author lixian
 **/
@RestController
@RequestMapping("wx/home/")
public class HomeController {

	@Autowired
	private HomeService homeService;

	/**
	 * 微信小程序端home首页显示数据
	 *
	 * @return 首页显示数据
	 */
	@GetMapping("index")
	public Object homeIndex() {
		IndexVO indexVO = homeService.getIndexInfo();
		if (indexVO == null) {
			return ResponseUtil.fail();
		}
		return ResponseUtil.ok(indexVO);
	}
}
